#include "udpsever.h"
#include <memory>
#include "dict.hpp"

void Usege(string argv)
{
    cout << argv << " + local_ip + local_port" << endl;
}

int main(int args,char* argv[])
{
    EnableCout();
    if(args != 3)
    {
        Usege(argv[0]);
        exit(USEGE_ERROR);
    }
    //翻译模块
    Dict dict;

    //网络模块
    string ip = argv[1];
    uint16_t port = stoi(argv[2]);
    //加上bind，绑定另一个类的成员函数
    unique_ptr<SocketSever> sever = make_unique<SocketSever>(ip,port,bind(&Dict::Translate,&dict,placeholders::_1));
    sever->InitSever();
    sever->start();
    return 0;
}